//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: TimestampAttribute.cs
//
//  Description: Attribute to mark a member as time stamp holder.
// 
//--------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;

namespace Chili.Opf3.Concurrency.TimeStamp
{
	/// <summary>This attribute is used to connect a member with the time stamp field of the
	/// <see cref="TimeStampConcurrencyManager">TimeStampConcurrencyManager</see> in the storage.</summary>
	/// <remarks>
	/// The TimeStampAttribute is used to connect a member of the persistent class with a field of the storage. The property is
	/// used as time stamp property for the <see cref="TimeStampConcurrencyManager">TimeStampConcurrencyManager</see>. Every time
	/// and update is performed the time stamp is checked of being changed. If the stamp changed the object was modified by somebody
	/// else in the mean time (in the time being in memory).
	/// </remarks>
	/// <example>
	///     The following example shows how to use the TimeStampAttribute in a persistent class.
	///     <code lang="CS">
	/// [Persistent("USER")]
	/// public class User
	/// {
	///     // ... Other code of the class.
	///
	///     [TimeStamp]
	///		[Field("TIME_STAMP")]
	///     public string TimeStamp
	///     {
	///         // ... code of the property.
	///     }
	/// }
	///     </code>
	/// </example>
	[Serializable]
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class TimeStampAttribute : Attribute
	{
		/// <summary>
		/// Creates a new instance of the <see cref="TimeStampAttribute">TimeStampAttribute Class</see>.
		/// </summary>
		public TimeStampAttribute()
		{
		}
	}
}
